let students = [
  { id: 1, name: '张三', age: 20, gender: '男', major: '计算机科学' },
  { id: 2, name: '李四', age: 21, gender: '女', major: '软件工程' }
];

export default {
  getStudents() {
    return students;
  },
  
  addStudent(student) {
    const newId = students.length > 0 ? Math.max(...students.map(s => s.id)) + 1 : 1;
    students.push({...student, id: newId});
    return newId;
  },
  
  updateStudent(updatedStudent) {
    const index = students.findIndex(s => s.id === updatedStudent.id);
    if (index !== -1) {
      students[index] = updatedStudent;
      return true;
    }
    return false;
  },
  
  deleteStudent(id) {
    const initialLength = students.length;
    students = students.filter(s => s.id !== id);
    return students.length !== initialLength;
  }
};